package org.fuys.coder.infrastructure.repository;

import org.fuys.coder.domain.mailbox.model.vo.MailVO;
import org.fuys.coder.domain.mailbox.repository.IMailBoxRepository;
import org.fuys.coder.infrastructure.util.RedisUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @projectName: fuys-low-coder
 * @package: org.fuys.coder.infrastructure.repository
 * @className: MailBoxRepository
 * @author: WangJing
 * @description: 收件箱仓储实现类
 * @date: 2024/9/6 16:38
 * @version: 1.0
 */
@Service
public class MailBoxRepository implements IMailBoxRepository {
    @Resource
    private RedisUtil redisUtil;

    @Override
    public void addMailToUsers(List<String> redisKeys, MailVO mail) {
        redisUtil.multipleKeyListInsert(redisKeys,mail);
    }

    @Override
    public void clearBoxItems(String redisKey, List<Integer> indexes) {
        redisUtil.removeListItems(redisKey,indexes);
    }

    @Override
    public List<Object> getMailBoxInfo(String redisKey) {
        return redisUtil.getList(redisKey);
    }

    @Override
    public void addMail(String redisKey, MailVO mailVO) {
        redisUtil.addList(redisKey,mailVO);
    }
}
